package com.j4dream.repo;

import com.db4o.Db4oEmbedded;
import com.db4o.ObjectContainer;
import com.j4dream.Entity.DetailItemDBVO;

import java.util.List;

/**
 * Created by j4dream on 14-3-9.
 */
public class DetailRepo {
    private String DB4OFILENAME="jiZhang.db4o";

    public void saveDetailItem(DetailItemDBVO data){
        // accessDb4o
        ObjectContainer db = Db4oEmbedded.openFile(Db4oEmbedded
                .newConfiguration(), DB4OFILENAME);
        try {
            db.store(data);
        } finally {
            db.close();
        }
    }

    public List<DetailItemDBVO> fildAll(){
        ObjectContainer db = Db4oEmbedded.openFile(Db4oEmbedded
                .newConfiguration(), DB4OFILENAME);
        List <DetailItemDBVO> list=null;
        try {
           list = db.query(DetailItemDBVO.class);
        } finally {
            db.close();
        }
        return list;
    }
}
